home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / xybots.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  9KB  |  329 lines

  1. /***************************************************************************
  2.  
  3. Xybots Memory Map
  4. -----------------------------------
  5.  
  6. driver by Aaron Giles
  7.  
  8. XYBOTS 68000 MEMORY MAP
  9.  
  10. Function                           Address        R/W  DATA
  11. -------------------------------------------------------------
  12. Program ROM                        000000-007FFF  R    D0-D15
  13. Program ROM/SLAPSTIC               008000-00FFFF  R    D0-D15
  14. Program ROM                        010000-02FFFF  R    D0-D15
  15.  
  16. NOTE: All addresses can be accessed in byte or word mode.
  17.  
  18.  
  19. XYBOTS 6502 MEMORY MAP
  20.  
  21.  
  22. ***************************************************************************/
  23.  
  24.  
  25.  
  26. #include "driver.h"
  27. #include "machine/atarigen.h"
  28. #include "sndhrdw/atarijsa.h"
  29. #include "vidhrdw/generic.h"
  30.  
  31.  
  32. WRITE_HANDLER( xybots_playfieldram_w );
  33.  
  34. int xybots_vh_start(void);
  35. void xybots_vh_stop(void);
  36. void xybots_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  37.  
  38. void xybots_scanline_update(int scanline);
  39.  
  40.  
  41.  
  42. /*************************************
  43.  *
  44.  *    Initialization
  45.  *
  46.  *************************************/
  47.  
  48. static void update_interrupts(void)
  49. {
  50.     int newstate = 0;
  51.  
  52.     if (atarigen_video_int_state)
  53.         newstate = 1;
  54.     if (atarigen_sound_int_state)
  55.         newstate = 2;
  56.  
  57.     if (newstate)
  58.         cpu_set_irq_line(0, newstate, ASSERT_LINE);
  59.     else
  60.         cpu_set_irq_line(0, 7, CLEAR_LINE);
  61. }
  62.  
  63.  
  64. static void init_machine(void)
  65. {
  66.     atarigen_eeprom_reset();
  67.     atarigen_slapstic_reset();
  68.     atarigen_interrupt_reset(update_interrupts);
  69.     atarigen_scanline_timer_reset(xybots_scanline_update, 8);
  70.     atarijsa_reset();
  71. }
  72.  
  73.  
  74.  
  75. /*************************************
  76.  *
  77.  *    I/O handlers
  78.  *
  79.  *************************************/
  80.  
  81. static READ_HANDLER( special_port1_r )
  82. {
  83.     static int h256 = 0x0400;
  84.  
  85.     int result = input_port_1_r(offset);
  86.  
  87.     if (atarigen_cpu_to_sound_ready) result ^= 0x0200;
  88.     result ^= h256 ^= 0x0400;
  89.     return result;
  90. }
  91.  
  92.  
  93.  
  94. /*************************************
  95.  *
  96.  *    Main CPU memory handlers
  97.  *
  98.  *************************************/
  99.  
  100. static struct MemoryReadAddress main_readmem[] =
  101. {
  102.     { 0x000000, 0x03ffff, MRA_ROM },
  103.     { 0xff8000, 0xff8fff, MRA_BANK3 },
  104.     { 0xff9000, 0xffadff, MRA_BANK2 },
  105.     { 0xffae00, 0xffafff, MRA_BANK4 },
  106.     { 0xffb000, 0xffbfff, MRA_BANK5 },
  107.     { 0xffc000, 0xffc7ff, paletteram_word_r },
  108.     { 0xffd000, 0xffdfff, atarigen_eeprom_r },
  109.     { 0xffe000, 0xffe0ff, atarigen_sound_r },
  110.     { 0xffe100, 0xffe1ff, input_port_0_r },
  111.     { 0xffe200, 0xffe2ff, special_port1_r },
  112.     { -1 }  /* end of table */
  113. };
  114.  
  115.  
  116. static struct MemoryWriteAddress main_writemem[] =
  117. {
  118.     { 0x000000, 0x03ffff, MWA_ROM },
  119.     { 0xff8000, 0xff8fff, MWA_BANK3, &atarigen_alpharam, &atarigen_alpharam_size },
  120.     { 0xff9000, 0xffadff, MWA_BANK2 },
  121.     { 0xffae00, 0xffafff, MWA_BANK4, &atarigen_spriteram, &atarigen_spriteram_size },
  122.     { 0xffb000, 0xffbfff, xybots_playfieldram_w, &atarigen_playfieldram, &atarigen_playfieldram_size },
  123.     { 0xffc000, 0xffc7ff, paletteram_IIIIRRRRGGGGBBBB_word_w, &paletteram },
  124.     { 0xffd000, 0xffdfff, atarigen_eeprom_w, &atarigen_eeprom, &atarigen_eeprom_size },
  125.     { 0xffe800, 0xffe8ff, atarigen_eeprom_enable_w },
  126.     { 0xffe900, 0xffe9ff, atarigen_sound_w },
  127.     { 0xffea00, 0xffeaff, watchdog_reset_w },
  128.     { 0xffeb00, 0xffebff, atarigen_video_int_ack_w },
  129.     { 0xffee00, 0xffeeff, atarigen_sound_reset_w },
  130.     { -1 }  /* end of table */
  131. };
  132.  
  133.  
  134.  
  135. /*************************************
  136.  *
  137.  *    Port definitions
  138.  *
  139.  *************************************/
  140.  
  141. INPUT_PORTS_START( xybots )
  142.     PORT_START    /* ffe100 */
  143.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
  144.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  145.     PORT_BITX(0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2, "P2 Twist Right", KEYCODE_W, IP_JOY_DEFAULT )
  146.     PORT_BITX(0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2, "P2 Twist Left", KEYCODE_Q, IP_JOY_DEFAULT )
  147.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 | IPF_8WAY )
  148.     PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 | IPF_8WAY )
  149.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 | IPF_8WAY )
  150.     PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 | IPF_8WAY )
  151.     PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )
  152.     PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  153.     PORT_BITX(0x0400, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1, "P1 Twist Right", KEYCODE_X, IP_JOY_DEFAULT )
  154.     PORT_BITX(0x0800, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1, "P1 Twist Left", KEYCODE_Z, IP_JOY_DEFAULT )
  155.     PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 | IPF_8WAY )
  156.     PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 | IPF_8WAY )
  157.     PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 | IPF_8WAY )
  158.     PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 | IPF_8WAY )
  159.  
  160.     PORT_START    /* ffe200 */
  161.     PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
  162.     PORT_SERVICE( 0x0100, IP_ACTIVE_LOW )
  163.     PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNUSED )     /* /AUDBUSY */
  164.     PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_UNUSED )    /* 256H */
  165.     PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_VBLANK )    /* VBLANK */
  166.     PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
  167.  
  168.     JSA_I_PORT_SWAPPED    /* audio port */
  169. INPUT_PORTS_END
  170.  
  171.  
  172.  
  173. /*************************************
  174.  *
  175.  *    Graphics definitions
  176.  *
  177.  *************************************/
  178.  
  179. static struct GfxLayout anlayout =
  180. {
  181.     8,8,    /* 8*8 chars */
  182.     512,    /* 512 chars */
  183.     2,        /* 2 bits per pixel */
  184.     { 0, 4 },
  185.     { 0, 1, 2, 3, 8, 9, 10, 11 },
  186.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
  187.     8*16    /* every char takes 16 consecutive bytes */
  188. };
  189.  
  190.  
  191. static struct GfxLayout pflayout =
  192. {
  193.     8,8,    /* 8*8 chars */
  194.     8192,    /* 8192 chars */
  195.     4,        /* 4 bits per pixel */
  196.     { 0, 1, 2, 3 },
  197.     { 0, 4, 8, 12, 16, 20, 24, 28 },
  198.     { 0*8, 4*8, 8*8, 12*8, 16*8, 20*8, 24*8, 28*8 },
  199.     32*8    /* every char takes 32 consecutive bytes */
  200. };
  201.  
  202.  
  203. static struct GfxLayout molayout =
  204. {
  205.     8,8,    /* 8*8 chars */
  206.     16384,    /* 16384 chars */
  207.     4,        /* 4 bits per pixel */
  208.     { 0, 1, 2, 3 },
  209.     { 0, 4, 8, 12, 16, 20, 24, 28 },
  210.     { 0*8, 4*8, 8*8, 12*8, 16*8, 20*8, 24*8, 28*8 },
  211.     32*8    /* every char takes 32 consecutive bytes */
  212. };
  213.  
  214.  
  215. static struct GfxDecodeInfo gfxdecodeinfo[] =
  216. {
  217.     { REGION_GFX1, 0, &pflayout,      512, 16 },        /* playfield */
  218.     { REGION_GFX2, 0, &molayout,      256, 48 },        /* sprites */
  219.     { REGION_GFX3, 0, &anlayout,        0, 64 },        /* characters 8x8 */
  220.     { -1 } /* end of array */
  221. };
  222.  
  223.  
  224.  
  225. /*************************************
  226.  *
  227.  *    Machine driver
  228.  *
  229.  *************************************/
  230.  
  231. static struct MachineDriver machine_driver_xybots =
  232. {
  233.     /* basic machine hardware */
  234.     {
  235.         {
  236.             CPU_M68000,        /* verified */
  237.             ATARI_CLOCK_14MHz/2,
  238.             main_readmem,main_writemem,0,0,
  239.             atarigen_video_int_gen,1
  240.         },
  241.         JSA_I_CPU
  242.     },
  243.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  244.     1,
  245.     init_machine,
  246.  
  247.     /* video hardware */
  248.     42*8, 30*8, { 0*8, 42*8-1, 0*8, 30*8-1 },
  249.     gfxdecodeinfo,
  250.     1024,1024,
  251.     0,
  252.  
  253.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_SUPPORTS_DIRTY | VIDEO_UPDATE_BEFORE_VBLANK,
  254.     0,
  255.     xybots_vh_start,
  256.     xybots_vh_stop,
  257.     xybots_vh_screenrefresh,
  258.  
  259.     /* sound hardware */
  260.     JSA_I_STEREO_SWAPPED,
  261.  
  262.     atarigen_nvram_handler
  263. };
  264.  
  265.  
  266.  
  267. /*************************************
  268.  *
  269.  *    ROM definition(s)
  270.  *
  271.  *************************************/
  272.  
  273. ROM_START( xybots )
  274.     ROM_REGION( 0x90000, REGION_CPU1 )    /* 8*64k for 68000 code */
  275.     ROM_LOAD_EVEN( "2112.c17",     0x00000, 0x10000, 0x16d64748 )
  276.     ROM_LOAD_ODD ( "2113.c19",     0x00000, 0x10000, 0x2677d44a )
  277.     ROM_LOAD_EVEN( "2114.b17",     0x20000, 0x08000, 0xd31890cb )
  278.     ROM_LOAD_ODD ( "2115.b19",     0x20000, 0x08000, 0x750ab1b0 )
  279.  
  280.     ROM_REGION( 0x14000, REGION_CPU2 )    /* 64k for 6502 code */
  281.     ROM_LOAD( "xybots.snd",   0x10000, 0x4000, 0x3b9f155d )
  282.     ROM_CONTINUE(             0x04000, 0xc000 )
  283.  
  284.     ROM_REGION( 0x40000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  285.     ROM_LOAD( "2102.l13",     0x00000, 0x08000, 0xc1309674 )
  286.     ROM_RELOAD(               0x08000, 0x08000 )
  287.     ROM_LOAD( "2103.l11",     0x10000, 0x10000, 0x907c024d )
  288.     ROM_LOAD( "2117.l7",      0x30000, 0x10000, 0x0cc9b42d )
  289.  
  290.     ROM_REGION( 0x80000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  291.     ROM_LOAD( "1105.de1",     0x00000, 0x10000, 0x315a4274 )
  292.     ROM_LOAD( "1106.e1",      0x10000, 0x10000, 0x3d8c1dd2 )
  293.     ROM_LOAD( "1107.f1",      0x20000, 0x10000, 0xb7217da5 )
  294.     ROM_LOAD( "1108.fj1",     0x30000, 0x10000, 0x77ac65e1 )
  295.     ROM_LOAD( "1109.j1",      0x40000, 0x10000, 0x1b482c53 )
  296.     ROM_LOAD( "1110.k1",      0x50000, 0x10000, 0x99665ff4 )
  297.     ROM_LOAD( "1111.kl1",     0x60000, 0x10000, 0x416107ee )
  298.  
  299.     ROM_REGION( 0x02000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  300.     ROM_LOAD( "1101.c4",      0x00000, 0x02000, 0x59c028a2 )
  301. ROM_END
  302.  
  303.  
  304.  
  305. /*************************************
  306.  *
  307.  *    Driver initialization
  308.  *
  309.  *************************************/
  310.  
  311. static void init_xybots(void)
  312. {
  313.     atarigen_eeprom_default = NULL;
  314.     atarigen_slapstic_init(0, 0x008000, 107);
  315.  
  316.     atarijsa_init(1, 2, 1, 0x0100);
  317.  
  318.     /* speed up the 6502 */
  319.     atarigen_init_6502_speedup(1, 0x4157, 0x416f);
  320.  
  321.     /* display messages */
  322. /*    atarigen_show_slapstic_message(); -- no known slapstic problems */
  323.     atarigen_show_sound_message();
  324. }
  325.  
  326.  
  327.  
  328. GAME( 1987, xybots, 0, xybots, xybots, xybots, ROT0, "Atari Games", "Xybots" )
  329.